import com.atguigu.realtime.bean.KeywordBean;

import java.lang.reflect.Field;
import java.util.Arrays;
import java.util.stream.Collectors;

/**
 * @Author lzc
 * @Date 2023/3/17 15:26
 */
public class Demo3 {
    public static void main(String[] args) {
        Class<KeywordBean> tClass = KeywordBean.class;
    
//        Field[] fields = tClass.getFields();  // 获取 public 的属性
        Field[] fields = tClass.getDeclaredFields(); // 所有属性
    
       /* String msg = "";
        for (Field field : fields) {
//            System.out.println(field.getName());
            msg += field.getName() + ",";
        }
        msg = msg.substring(0, msg.length() - 1);
        System.out.println(msg);*/
        String msg = Arrays.stream(fields)
            .map(f -> f.getName())
            .collect(Collectors.joining(","));
        System.out.println(msg);
    
    
    }
}
